# -*- coding: utf-8 -*-
"""
2024-02-12 
main
"""
"""


from PySide6.QtWidgets import QApplication, QWidget

app = QApplication([])

# 创建一个QWidget实例
widget = QWidget()

# 设置窗口标题
widget.setWindowTitle('My First QWidget')

# 设置窗口大小
widget.setGeometry(100, 100, 300, 200)

# 显示窗口
widget.show()

# 运行应用程序的主事件循环
"""
from PySide6.QtCore import Slot, QSize
from PySide6.QtGui import QAction, QKeySequence
from PySide6.QtWidgets import QMainWindow, QApplication, QVBoxLayout, QHBoxLayout, QPushButton, QWidget, QMessageBox
from PySide6.QtCore import Qt
from PySide6.QtGui import QGuiApplication, QCloseEvent
## from PySide6.QtCore.Qt import 

##from PySide6.QtCore import WindowState

##from top.wardyan.utils import winformutils
from top.wardyan.core.action.baseaction import WMainWindow
from scriptwindow import *


# import rpyc

# cn = rpyc.connect("127.0.0.1", 8899)
# print("time is {}".format(cn.root.get_time()))
# print(cn.root.script_list())



class WDevClientMainWindow(WMainWindow):
    def __init__(self, name : str = __name__):
        WMainWindow.__init__(self, name)
        ## self.setWindowTitle("Eartquakes information")
        
        ## 显示窗体具体信息
        self.main()
    
    def button_click_script(self) :
        """ 按钮: 脚本管理 """
        ##QMessageBox.information(None, 'Message', 'button_click_script')
        self.setWindowTitle("脚本管理")
        self.setCentralWidget(WScriptWindow())
        

    def button_click_buildstr(self) :
        """ 按钮: 按序生成字符串 """
        self.setWindowTitle("脚本管理")

    def button_click_rfid(self) :
        """ 按钮: 科启奥RFID模拟器 """
        self.setWindowTitle("科启奥RFID模拟器")


    def button_click_pda(self) :
        """ 按钮: PDA开发辅助工具 """
        self.setWindowTitle("PDA开发辅助工具")


    def button_click_qrcode(self) :
        """ 按钮: 二维码工具 """
        self.setWindowTitle("二维码工具")


    def button_click_customize(self) :
        """ 按钮: 自定义报表管理 """
        self.setWindowTitle("自定义报表管理")


    def button_click_warning(self) :
        """ 按钮: 预警管理 """
        self.setWindowTitle("预警管理")


    def button_click_style(self) :
        """ 按钮: 款式库 """
        self.setWindowTitle("款式库")


    def button_click_dict(self) :
        """ 按钮: 数据字典 """
        self.setWindowTitle("数据字典")




    def initMenubar(self) :
        HEIGHT = 50
        hb : QHBoxLayout = QHBoxLayout()
        ## 快捷菜单: 1脚本管理 2按序生成字符串 科启奥RFID模拟器 PDA开发辅助工具 二维码工具 自定义报表管理 预警管理 款式库 数据字典
        btn : QPushButton = QPushButton("脚本管理")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_script)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("按序生成字符串")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_buildstr)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("科启奥RFID模拟器")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_rfid)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("PDA开发辅助工具")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_pda)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("二维码工具")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_qrcode)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("自定义报表管理")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_customize)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("预警管理")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_warning)
        hb.addWidget(btn)

        btn : QPushButton = QPushButton("款式库")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_style)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("数据字典")
        btn.setMinimumHeight(HEIGHT)
        btn.clicked.connect(self.button_click_dict)
        hb.addWidget(btn)
        
        menuBar = QWidget()
        menuBar.setLayout(hb)
        menuBar.setMinimumHeight(HEIGHT)
        self.setMenuWidget(menuBar)

    
    def main(self) :
        self.initMenubar()
        ## self.setCentralWidget()



"""
class WScriptWindow (WDevClientMainWindow) :
    def __init__(self, name : str = __name__):
        WDevClientMainWindow.__init__(self, name)
        self.setWindowTitle("脚本管理")
"""

if __name__ == "__main__" :     ## or 1 == 1
    app = QApplication([])
    w = WDevClientMainWindow()
    ## w = WScriptWindow()
    #w.show()
    app.exec()